package com.ccx.service.impl;

import com.ccx.mapper.EbNewsMapper;
import com.ccx.model.EbNews;
import com.ccx.service.NewsService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class NewsServicelmpl implements NewsService {
    @Autowired
    private EbNewsMapper ebNewsMapper;


    @Override
    public List<EbNews> list(int page, int pageSize) {
            PageHelper.startPage(page,pageSize);
            return ebNewsMapper.selectByExample(null);
        }

    @Override
    public Integer save(EbNews ebNews) {
        return  ebNewsMapper.insert(ebNews);
    }

    @Override
    public EbNews select0ne(Integer euUserId) {
        return ebNewsMapper.selectByPrimaryKey(euUserId);
    }

    @Override
    public  Integer updateNews(EbNews ebNews){
        return ebNewsMapper.updateByPrimaryKey(ebNews);
    }

    @Override
    public  int delete(EbNews ebNews){
        return  ebNewsMapper.deleteByPrimaryKey(ebNews.getEnId());
    }

}